package org.qy.star_server.data.mapper;

import org.apache.ibatis.annotations.Mapper;
import org.qy.star_server.core.*;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @author yinger
 * @description 元数据持久化操作
 * @date 2024/3/26 08:10
 **/
@Mapper
public interface MetaMapper {
    /**
     * 自动创建数据表 必须按照顺序建表，存在外键约束
     */
    void createUserTable();

    void createVirtualHostTable();

    void createExchangeTable();

    void createQueueTable();

    void createBindingTable();

    /**
     * 用户操作
     */
    void insertUser(User user);

    User selectUser(String username);

    void deleteUser(String username);

    void updateUser(User user);

    List<User> selectAllUser();

    /**
     * 虚拟机操作
     */
    void insertVirtualHost(VirtualHost virtualHost);

    VirtualHost selectVirtualHost(VirtualHost virtualHost);

    void deleteVirtualHost(VirtualHost virtualHost);

    List<VirtualHost> selectAllVirtualHost();

    /**
     * 交换机操作
     */
    void insertExchange(Exchange exchange);

    Exchange selectExchange(Exchange exchange);

    void deleteExchange(Exchange exchange);

    List<Exchange> selectAllExchange();

    /**
     * 队列操作
     */
    void insertQueue(Queue queue);

    Queue selectQueue(Queue queue);

    void deleteQueue(Queue queue);

    List<Queue> selectAllQueue();

    /**
     * 绑定操作
     */
    void insertBinding(Binding binding);

    Binding selectBinding(Binding binding);

    void deleteBinding(Binding binding);

    List<Binding> selectAllBinding();
}
